"""
@author: wy
@time: 2023/12/4 15:53
"""
# from download import download_img
from download import download, download_img
from bs4 import BeautifulSoup
import os

path = "sc_pic"
if  not os.path.isdir(path):
    os.mkdir(path)

url = "https://www.sanchuangedu.cn/"
text = download(url)
print(text)

sc = BeautifulSoup(text,"lxml")
print(help(sc.select))
imgs =sc.select("img")
for img in imgs:
    name = img["src"]
    img_src = url+name
    print(img_src)
    filename = f"{path}/{name}"
    with open(filename,"wb") as fp:
        fp.write(download_img(img_src))


